<?
//获取指定数据:
//$belong 所属板块
//$sort_by:排序项,例："nid,listorder desc"
//$item:项
//$item_str:项的值
//number:获取数据数量,0则无限
//publish是必须

function get_detail_list_by_item($belong,$sortby,$condition,$item,$item_str,$number)
{

    global $table_Prefix;
    global $sys_list_table;

//设置需要搜索的表格的前缀后缀
    $table_Suffix = $sys_list_table;
    $table        = $table_Prefix . $table_Suffix;
//设置需要搜索的表格的前缀后缀


    if($condition)
    {
        $condition="and $condition";
    }
    else
    {
        $condition="";
    }



    if($number){$limit_str=" limit ".$number;}
    else{$limit_str="";}

    $sort_str=" order by ".$sortby;

$sqlstr="SELECT * FROM ".$table." where $item = '".$item_str."'".$condition." and belong= '".$belong."' ".$sort_str.$limit_str;

       $detail_list = mysql_query($sqlstr);

        while ($row = mysql_fetch_array($detail_list)) {
            $detail['nid'][]  = $row['nid'];
            $detail['icon'][] = $row['icon'];
            $detail['link'][] = $row['link'];
            $detail['name'][] = $row['name'];
            $detail['url'][] = $row['url'];
        }
    return $detail;
}
?>

